package com.cqemme.activitiservice.service.impl;

import com.cqemme.activitiservice.service.MyHistoryService;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricActivityInstance;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author nejery
 */
@Slf4j
@Service
public class HistoryServiceImpl implements MyHistoryService {

    @Resource
    private HistoryService historyService;

    @Override
    public List<HistoricActivityInstance> selectHistoryNode(String processInstanceId){
        log.info("查询实例节点ID：{}",processInstanceId);
        return historyService.createHistoricActivityInstanceQuery()
                .processInstanceId(processInstanceId)
                .orderByHistoricActivityInstanceStartTime()
                .asc()
                .list();
    }

}
